<?php

namespace app\admin\service;

use app\admin\dao\MemberDraftDao;
use app\admin\model\UM as UM;
use ShidianUtil\Utils\TimeUtil;

/**
 * Class LawyerDraftStatisticsService
 * @package app\member\service
 */
class LawyerDraftStatisticsService
{

    private MemberDraftDao $memberDraftDao;

    public function __construct(MemberDraftDao $memberDraftDao)
    {
        $this->memberDraftDao = $memberDraftDao;
    }

    /**
     * @param UM|null $user
     * @param $checkStatus
     * @param $provinceId
     * @param $cityId
     * @param $startTime
     * @param $endTime
     * @param $kw
     * @return array
     */
    public function read(?UM $user, $checkStatus, $provinceId, $cityId, $startTime, $endTime, $kw, $subType): array
    {
        if(is_numeric($endTime)){
            $endTime = TimeUtil::stamp(TimeUtil::DAY, $endTime, false);
        }
        return $this->memberDraftDao->statisticsListLawyersDraft($checkStatus, $provinceId, $cityId, $startTime, $endTime, $kw, $subType);
    }

}
